package com.province.platform.core.job.scheduler;

import com.province.platform.common.utils.Configuration;
import com.province.platform.core.communicator.AbstractContainerCommunicator;
import com.province.platform.core.constants.CoreConstants;
import org.apache.commons.lang3.Validate;

import java.util.List;

public abstract class AbstractScheduler {

    private Long jobId;
    private AbstractContainerCommunicator containerCommunicator;

    public void schedule(List<Configuration> configurations) {
        Validate.notNull(configurations, "scheduler配置不能为空");
        int reportIntervalInMillSec = configurations.get(0).getInt(CoreConstants.CORE_CONTAINER_JOB_REPORT_INTERVAL, 30000);
        int sleepIntervalInMillSec = configurations.get(0).getInt(CoreConstants.CORE_CONTAINER_JOB_SLEEP_INTERVAL, 10000);

        this.jobId = configurations.get(0).getLong(CoreConstants.CORE_CONTAINER_JOB_ID);

        /**
         * 给 taskGroupContainer 的Communication 注册
         */
        this.containerCommunicator.registerCommunication(configurations);
    }
}
